package com.goldmantis.alitrip.service;

import com.goldmantis.alitrip.common.BaseService;
import com.goldmantis.alitrip.common.Function;
import com.taobao.api.*;
import com.taobao.api.request.AlitripBtripInvoiceGetRequest;
import com.taobao.api.response.AlitripBtripInvoiceGetResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author:Shmily
 * @Description:
 * @Date:Create in 17:44 2018/1/15
 */
@Service
public class InvoiceService extends BaseService {

    @Autowired
    private  TaobaoClient client;

    /**
     * 根据用户获取发票
     * @param userId
     * @return
     * @throws Exception
     */
    public AlitripBtripInvoiceGetResponse getInvoiceByUserId(final String userId) throws Exception {
        AlitripBtripInvoiceGetRequest req = new AlitripBtripInvoiceGetRequest();
        req.setCorpId(corp_id);
        req.setUserId(userId);
        AlitripBtripInvoiceGetResponse rsp = client.execute(req, accessToken);
        return rsp;

    }
}
